<template>
	<view class="">
		<view class="content">
			<view class="chwl">
				<u-image border-radius="6" width="164rpx" height="137rpx" :src="info.logo"></u-image>
				<view class="chwl-right">
					<uni-title title="">{{info.title}}</uni-title>
					<view class="" style="color: #fd5049;margin: 13rpx 0;">
						{{info.qg_time}}
					</view>
					<view class="chwl-right1" v-if="info.distance">
						<text>距离{{info.distance<1?(info.distance*1000).toFixed(0)+'m':(info.distance).toFixed(2)+'km'}}</text>
					</view>
				</view>
			</view>
			<text class="dz">地址：{{info.address}}</text>
			<view class="cpsm">
				<view class="" style="font-weight: bold;">
					产品说明
				</view>
				<view class="uni-textarea">
				      <u-parse :html="info.content"></u-parse>
				 </view>
			</view>
			<view class="yhlc">
				<view class="" style="font-weight: bold;">
					优惠流程
				</view>
				<view class="uni-textarea">
				            <u-parse :html="info.sale_content"></u-parse>
				            </view>
			</view>
			<view class="tbsm">
				<view class="" style="font-weight: bold;">
					特别说明
				</view>
				<view class="uni-textarea">
				            <u-parse :html="info.declare"></u-parse>
				</view>
			</view>
		</view>
		<view class="footer">
			<text>剩{{info.num}}名</text>
			<button class="mini-btn" type="default" size="mini" v-if="info.num>0 && info.is_shop==0" @tap.stop="snapUp(info)">抢购</button>
			<button class="mini-btn" style="color: rgba(0,0,0,.3);background-color: #f7f7f7;" type="default" size="mini" :disabled="true" v-else-if="info.is_shop==1">已领取</button>
			<button class="mini-btn" style="color: rgba(0,0,0,.3);background-color: #f7f7f7;" type="default" size="mini" :disabled="true" v-else>已结束</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				info:{}
			}
		},
		onLoad() {
			this.info = uni.getStorageSync('detailInfo')
		},
		methods:{
			snapUp(row){
				this.$u
					.post('/wxapi/Api/shop', {
						token: this.vuex_token.accessToken,
						goods_id:row.id
					})
					.then(res => {
						if(res.code===200){
							row.num--
							row.is_shop=1
							uni.showToast({
								icon: 'none',
								title: '抢购成功'
							});
						}
					});
			}
		}
	}
</script>

<style scoped>
	.content {
		padding:0 30rpx;
		box-sizing: border-box;
	}
	.content .btn{
		background-color: red;
		position: fixed;
		bottom: 0rpx;
	}
	.cpsm{
		margin-top: 30rpx;
	}
	.chtit{
		font-size: 40rpx;
		margin-left: 20rpx;
		margin-bottom: 40rpx;
	}
	.chwl{
		
		box-sizing: border-box;
		display: flex;
		background-color: #fff;
		position: relative;
		padding:30rpx 0rpx;
	}
	.chwl-right{
		flex: 1;
		margin-left: 18rpx;
	}
	.chwl-right1{
		color:#c8c8c8 ;
	}
	.ql-container{
		height: 100rpx;
	}
	.footer{
		position: fixed;
		bottom: 0;
		height: 110rpx;
		line-height: 110rpx;
		width: 100%;
		padding: 0 20rpx;
	}
	.footer button{
		background-color:#fb4d4e ;
		border-radius: 30rpx;
		width: 250rpx;
		float: right;
		margin-top: 20rpx;
		color: #fff;
		font-size: 30rpx;
		border: 0;
		
	}
	.footer button::after{
		border:0;
	}
	.uni-textarea{
		margin-bottom: 30rpx;
		margin-top: 20rpx;
	}
</style>
